import axios from './axios'
import qs from 'qs'

export function getCustomer() {
    const data = qs.stringify({pageSize: 100000});
    return axios.post('/customer/manage/get_customer_list_by_param.do', data).then(res => Promise.resolve(res.data))
}

export function addCustomer(customer) {
    const data = qs.stringify(customer);
    return axios.post('/customer/manage/add_customer.do', data).then(res => Promise.resolve(res.data))
}

export function modCustomer(customer) {
    const data = qs.stringify(customer);
    return axios.post('/customer/manage/update_customer.do',data).then(res=>Promise.resolve(res.data));
}
export function changeCustomerStatus({customerId,status}) {
    const data = qs.stringify({customerId,status});
    return axios.post('/customer/manage/disable_customer.do',data).then(res=>Promise.resolve(res.data))
}

export function getSpecCustomer() {
    return axios.get('/special_customer/manage/select_special_customer.do').then(res=>Promise.resolve(res.data))
}

export function getCustomerEmployee(customerId) {
    return axios.post('/special_customer/manage/select_receiver.do',qs.stringify({customerId})).then(res=>Promise.resolve(res.data))
}
export function addContact(contact) {
    return axios.post('/special_customer/manage/save_customer_contact.do',qs.stringify(contact)).then(res=>Promise.resolve(res.data))
}
export function modContact(contact) {
    return axios.post('/special_customer/manage/update_customer_contact.do',qs.stringify(contact)).then(res=>Promise.resolve(res.data))
}
export function addSpecCustomer(customerName) {
    return axios.post('/special_customer/manage/add_customer_special.do',qs.stringify({customerName})).then(res=>Promise.resolve(res.data))
}
export function modSpecCustomer({id,customerName}) {
    return axios.post('/special_customer/manage/update_customer_special.do',qs.stringify({id,customerName})).then(res=>Promise.resolve(res.data))
}
export function deleteSpecCustomer(id) {
    return axios.post('/special_customer/manage/delete_customer_contact.do',qs.stringify({id})).then(res=>Promise.resolve(res.data))
}